package cn.pet.service.manage.service.impl;

import cn.pet.service.manage.entity.vo.CommonStat;
import cn.pet.service.manage.entity.vo.CommonStatVO;
import cn.pet.service.manage.entity.vo.OrderSendingList;
import cn.pet.service.manage.entity.vo.SubscribeApprovingList;
import cn.pet.service.manage.mapper.StatMapper;
import cn.pet.service.manage.service.StatService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zwr
 * @version 1.0
 * @description TODO
 * @date 2023/3/6 20:10
 */
@Service
public class StatServiceImpl implements StatService {

    @Resource
    private StatMapper statMapper;

    @Override
    public CommonStat commonStat() {
        CommonStat commonStat = new CommonStat();
        commonStat.setMemberCount(statMapper.memberCount());
        commonStat.setShopOrderCount(statMapper.shopOrderCount());
        commonStat.setSubscribeApprovingCount(statMapper.subscribeServiceApprovingCount());
        commonStat.setSubscribeApprovedCount(statMapper.subscribeServiceApprovedCount());
        commonStat.setSubscribeOrderCount(statMapper.subscribeOrderCount());
        commonStat.setGoodsUsingCount(statMapper.goodsUsingCount());
        commonStat.setGoodsUNotUseCount(statMapper.goodsUNotUseCount());
        return commonStat;
    }

    @Override
    public List<SubscribeApprovingList> listSubApprovingLists() {
        return statMapper.listSubApprovingLists();
    }

    @Override
    public List<OrderSendingList> listOrderSendingLists() {
        return statMapper.listOrderSendingLists();
    }

    @Override
    public CommonStatVO getCommonStat() {
        CommonStatVO commonStatVO = new CommonStatVO();
        commonStatVO.setEmployeeNumber(statMapper.employeeCount());
        commonStatVO.setMemberNumber(statMapper.memberCount());
        commonStatVO.setGoodsUsingNumber(statMapper.goodsUsingCount());
        commonStatVO.setNotUseMember(statMapper.memberNotUseCount());
        commonStatVO.setSubscribeNumber(statMapper.subscribeCount());
        commonStatVO.setShopCommentNumber(statMapper.goodsCommentCount());
        commonStatVO.setShopOrderFinishedNumber(statMapper.shopOrderFinishedCount());
        commonStatVO.setSubscribeOrderNumber(statMapper.subscribeOrderCount());
        commonStatVO.setSubscribePassNums(statMapper.subscribeServiceApprovedCount());
        commonStatVO.setSubscribeRejectNums(statMapper.subscribeServiceApprovedFailCount());
        commonStatVO.setSubscribeSubmitNums(statMapper.subscribeServiceSubmitCount());
        return commonStatVO;
    }
}
